﻿using System;
using Microsoft.Xna.Framework;
using ShevaEngine.Core.Attributes;
using ShevaEngine.Core.Modules.Graphics.Cameras;
using ShevaEngine.Core.Modules.Scenes;

namespace ShevaEngine.Core.Modules.Graphics.Lights
{
    /// <summary>
    /// Base light class.
    /// </summary>
    public class Light : SceneObject
    {
        /// <summary>Name.</summary>        
        [EditableAttribute(true)]        
        public string Name;
        /// <summary>Diffuse color.</summary>        
        [SettingsControlTypeAttribute(SettingsControlType.ColorPicker), EditableAttribute(true)]
        public Color DiffuseColor;
        /// <summary>Light intensity.</summary>
        [SettingsControlTypeAttribute(SettingsControlType.NumericUpDown), BoundingAttribute(0.1f, 100f), EditableAttribute(true)]
        public float Intensity;
        /// <summary>Light radius.</summary>
        [SettingsControlTypeAttribute(SettingsControlType.NumericUpDown), BoundingAttribute(0.1f, 1000f), EditableAttribute(true)]
        public float Radius;
        /// <summary>Enabled.</summary>        
        [SettingsControlTypeAttribute(SettingsControlType.CheckBox), EditableAttribute(true)]
        public Boolean Enabled;

        /// <summary>Shadow map type.</summary>
        [SettingsControlTypeAttribute(SettingsControlType.TextBox), EditableAttribute(true)]
        public ShadowMapType ShadowMapType;        

        /// <summary>
        /// Constructor.
        /// </summary>
        public Light()
            : base()
        {
            this.Name = "Light";

            this.World = Matrix.Identity;
            this.DiffuseColor = Color.White;
            this.Intensity = 1;
            this.Radius = 10;
            this.ShadowMapType = ShadowMapType.None;
            this.Enabled = true;
        }

        /// <summary>
        /// Override ToString().
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return this.Name;
        }        

        /// <summary>
        /// Methods add items in rendering pipeline.
        /// </summary>
        /// <param name="renderinPipeline"></param>
        public override void AddInRenderingPipeline(RenderingPipeline renderingPipeline, Camera camera)
        {
        }

        /// <summary>
        /// Methods add items in rendering pipeline.
        /// </summary>
        /// <param name="renderinPipeline"></param>
        public override void AddInRenderingPipeline(RenderingPipeline renderingPipeline, Vector3 position, float distance)
        {
        }
    }

    /// <summary>
    /// Shadow map type.
    /// </summary>
    public enum ShadowMapType
    {
        None,
        DualParaboloid,
    }
}
